home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / matrix / test.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-18  |  4.8 KB  |  213 lines

  1. /* matrix/test.c
  2.  * 
  3.  * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough
  4.  * 
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or (at
  8.  * your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #include <config.h>
  21.  
  22. #ifdef GSL_RANGE_CHECK_OFF
  23. #undef GSL_RANGE_CHECK_OFF
  24. #endif
  25.  
  26. #include <stdlib.h>
  27. #include <stdio.h>
  28. #include <math.h>
  29. #include <gsl/gsl_math.h>
  30. #include <gsl/gsl_matrix.h>
  31. #include <gsl/gsl_test.h>
  32. #include <gsl/gsl_ieee_utils.h>
  33.  
  34. #define M 53
  35. #define N 107
  36.  
  37. int status = 0;
  38.  
  39. #ifndef DESC
  40. #define DESC ""
  41. #endif
  42.  
  43. #define BASE_GSL_COMPLEX_LONG
  44. #include "templates_on.h"
  45. #include "test_complex_source.c"
  46. #include "templates_off.h"
  47. #undef  BASE_GSL_COMPLEX_LONG
  48.  
  49. #define BASE_GSL_COMPLEX
  50. #include "templates_on.h"
  51. #include "test_complex_source.c"
  52. #include "templates_off.h"
  53. #undef  BASE_GSL_COMPLEX
  54.  
  55. #define BASE_GSL_COMPLEX_FLOAT
  56. #include "templates_on.h"
  57. #include "test_complex_source.c"
  58. #include "templates_off.h"
  59. #undef  BASE_GSL_COMPLEX_FLOAT
  60.  
  61. #define BASE_LONG_DOUBLE
  62. #include "templates_on.h"
  63. #include "test_source.c"
  64. #include "templates_off.h"
  65. #undef  BASE_LONG_DOUBLE
  66.  
  67. #define BASE_DOUBLE
  68. #include "templates_on.h"
  69. #include "test_source.c"
  70. #include "templates_off.h"
  71. #undef  BASE_DOUBLE
  72.  
  73. #define BASE_FLOAT
  74. #include "templates_on.h"
  75. #include "test_source.c"
  76. #include "templates_off.h"
  77. #undef  BASE_FLOAT
  78.  
  79. #define BASE_ULONG
  80. #include "templates_on.h"
  81. #include "test_source.c"
  82. #include "templates_off.h"
  83. #undef  BASE_ULONG
  84.  
  85. #define BASE_LONG
  86. #include "templates_on.h"
  87. #include "test_source.c"
  88. #include "templates_off.h"
  89. #undef  BASE_LONG
  90.  
  91. #define BASE_UINT
  92. #include "templates_on.h"
  93. #include "test_source.c"
  94. #include "templates_off.h"
  95. #undef  BASE_UINT
  96.  
  97. #define BASE_INT
  98. #include "templates_on.h"
  99. #include "test_source.c"
  100. #include "templates_off.h"
  101. #undef  BASE_INT
  102.  
  103. #define BASE_USHORT
  104. #include "templates_on.h"
  105. #include "test_source.c"
  106. #include "templates_off.h"
  107. #undef  BASE_USHORT
  108.  
  109. #define BASE_SHORT
  110. #include "templates_on.h"
  111. #include "test_source.c"
  112. #include "templates_off.h"
  113. #undef  BASE_SHORT
  114.  
  115. #define BASE_UCHAR
  116. #include "templates_on.h"
  117. #include "test_source.c"
  118. #include "templates_off.h"
  119. #undef  BASE_UCHAR
  120.  
  121. #define BASE_CHAR
  122. #include "templates_on.h"
  123. #include "test_source.c"
  124. #include "templates_off.h"
  125. #undef  BASE_CHAR
  126.  
  127. void my_error_handler (const char *reason, const char *file,
  128.                int line, int err);
  129.  
  130. int
  131. main (void)
  132. {
  133.   gsl_ieee_env_setup ();
  134.  
  135.   test_func ();
  136.   test_float_func ();
  137.   test_long_double_func ();
  138.   test_ulong_func ();
  139.   test_long_func ();
  140.   test_uint_func ();
  141.   test_int_func ();
  142.   test_ushort_func ();
  143.   test_short_func ();
  144.   test_uchar_func ();
  145.   test_char_func ();
  146.   test_complex_func ();
  147.   test_complex_float_func ();
  148.   test_complex_long_double_func ();
  149.  
  150.   test_text ();
  151.   test_float_text ();
  152. #ifdef HAVE_PRINTF_LONGDOUBLE
  153.   test_long_double_text ();
  154. #endif
  155.   test_ulong_text ();
  156.   test_long_text ();
  157.   test_uint_text ();
  158.   test_int_text ();
  159.   test_ushort_text ();
  160.   test_short_text ();
  161.   test_uchar_text ();
  162.   test_char_text ();
  163.   test_complex_text ();
  164.   test_complex_float_text ();
  165. #ifdef HAVE_PRINTF_LONGDOUBLE
  166.   test_complex_long_double_text ();
  167. #endif
  168.  
  169.   test_binary ();
  170.   test_float_binary ();
  171.   test_long_double_binary ();
  172.   test_ulong_binary ();
  173.   test_long_binary ();
  174.   test_uint_binary ();
  175.   test_int_binary ();
  176.   test_ushort_binary ();
  177.   test_short_binary ();
  178.   test_uchar_binary ();
  179.   test_char_binary ();
  180.   test_complex_binary ();
  181.   test_complex_float_binary ();
  182.   test_complex_long_double_binary ();
  183.  
  184.   gsl_warnings_off = 1;
  185.  
  186.   gsl_set_error_handler (&my_error_handler);
  187.  
  188.   test_trap ();
  189.   test_float_trap ();
  190.   test_long_double_trap ();
  191.   test_ulong_trap ();
  192.   test_long_trap ();
  193.   test_uint_trap ();
  194.   test_int_trap ();
  195.   test_ushort_trap ();
  196.   test_short_trap ();
  197.   test_uchar_trap ();
  198.   test_char_trap ();
  199.   test_complex_trap ();
  200.   test_complex_float_trap ();
  201.   test_complex_long_double_trap ();
  202.  
  203.   exit (gsl_test_summary ());
  204. }
  205.  
  206. void
  207. my_error_handler (const char *reason, const char *file, int line, int err)
  208. {
  209.   if (0)
  210.     printf ("(caught [%s:%d: %s (%d)])\n", file, line, reason, err);
  211.   status = 1;
  212. }
  213.